Tag Archives: pip

Solution of modulenotfounderror in running pychar

Solution of modulenotfounderror in running pychar

You need to load the corresponding module file in pychar. The specific steps are as follows: left click in file, select settings, and select【 python:xxx 】Click [Python interperter] in the toolbar to open the page and select [add] in the toolbar, After the page appears, select [existing environment] to load python.exe File my python.exe The file is in the following location: C: users, administrator, appdata, local, programs, python, python38

Common problems

one python.exe There is no required module file in the file

At this time, you need to use pip to install the corresponding files. The installation steps are as follows:
1. Open CMD
2. Enter the CD in the folder (the following is my path) C:: (users / administrator / appdata / local / programs / Python / python38 / scripts)
3. Start to install the file PIP install flash (take installing flash as an example)
4. Check if the installation is complete, you can use pip to install flash List to determine whether the installed file is in the list

2. “PIP” is not an internal or external command

1. Confirm that “PIP” is not an internal or external command, nor a runnable program or batch file.

2. Solution 1: go to the folder where pip is located, and copy the path
my path is: C:: (users, administrator, appdata, local, programs, python, python38, scripts)

3. Switch the working directory to the path of PIP
CD

4. Execute PIP again, method 1, success!

5. Method 2: add pip to environment variables
right click my computer and select properties

6. Select: Advanced – environment variable

7. Open path to edit, and add the directory path of PIP at the end

8. After confirming the setting of environment variables, method 2 is successful!

Anaconda installation opencv Python error solution

Error message: PIP _vendor. Urllib3. Exceptions. ReadTimeoutError:
HTTPSConnectionPool (host = “pypi.tuna.tsinghua.edu.cn”, the port = 443) : Read timed out.
directly in the console input PIP install opencv – python error as shown in figure:

May be because I accidentally canceled the cause behind all installation not
behind direct route directly to tsinghua source download and then switch to the installation was successful
tsinghua source: https://pypi.tuna.tsinghua.edu.cn/simple/opencv-python/
small pit: switch plate command is “E:”, rather than the CD disc cutting
reference: https://blog.csdn.net/qq_43766304/article/details/104862174

Package summary of installing python with CONDA

Install Python with Conda package summary ## title
If you want to find which package, go to the official website and download it directly to this directory (my directory location)

CD C:\ProgramData\Anaconda3\Lib
\ ProgramData\Anaconda3\Lib
\
PIP install torchvision-0.1.8-py2.py3-none-any.whl
p install torchvision-0.1.8-py2.py3-none-any.whl
PIP install torchvision-0.1.8-py2.py3-none-any.whl
PIP install torchvision-0.1.8-py2.py3-none-any.whl . (here torchvision 0.1.8 – py2 py3 – none – any. WHL, is my at https://pypi.org/project/torchvision/0.1.8/#files to download python library)
this time in the CMD import torchvision went wrong, but in the anaconda in the prompt is correct.
Everything will be all right!

Installation and unloading of Python module

Using the PIP command
If there are multiple versions of the system, use the corresponding PIP version to remove the corresponding Python version of the module
In python2.7 use pip3 above PIP python3.0
Installation module:
The python3 version USES the pip3 install module name
Such as installing python3 version of pygame

xubin@xubindeMBP:~/Python$ pip3 install pygame
Collecting pygame
  Using cached https://files.pythonhosted.org/packages/b9/89/aca02f8771727c2713c11a39c1cc295e4deb60be322be19ad7460570f978/pygame-1.9.4-cp37-cp37m-macosx_10_11_intel.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.4

Unloading module:
The python3 version USES the pip3 uninstall module name
Such as uninstalling pygame in python3

xubin@xubindeMBP:~/Python$ pip3 uninstall pygame
Uninstalling pygame-1.9.4:
  Would remove:
    /usr/local/include/python3.7m/pygame/_camera.h
    /usr/local/include/python3.7m/pygame/_pygame.h
    /usr/local/include/python3.7m/pygame/_surface.h
    /usr/local/include/python3.7m/pygame/bitmask.h
    /usr/local/include/python3.7m/pygame/camera.h
    /usr/local/include/python3.7m/pygame/fastevents.h
    /usr/local/include/python3.7m/pygame/font.h
    /usr/local/include/python3.7m/pygame/freetype.h
    /usr/local/include/python3.7m/pygame/mask.h
    /usr/local/include/python3.7m/pygame/mixer.h
    /usr/local/include/python3.7m/pygame/pgarrinter.h
    /usr/local/include/python3.7m/pygame/pgbufferproxy.h
    /usr/local/include/python3.7m/pygame/pgcompat.h
    /usr/local/include/python3.7m/pygame/pgopengl.h
    /usr/local/include/python3.7m/pygame/pygame.h
    /usr/local/include/python3.7m/pygame/scrap.h
    /usr/local/include/python3.7m/pygame/surface.h
    /usr/local/lib/python3.7/site-packages/pygame-1.9.4.dist-info/*
    /usr/local/lib/python3.7/site-packages/pygame/*
Proceed (y/n)?y
  Successfully uninstalled pygame-1.9.4

 

Mac upgrade pip

I haven’t upgraded PIP for a long time. Today I will upgrade once:

$ pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move
    rmtree(src)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/EGG-INFO/PKG-INFO'
You are using pip version 9.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Prompt permission is not enough, assign permission to the current user:

mac-temp:~ zyh$ sudo chown -R $USER /Library/Python/2.7

Upgrade again:

mac-temp:~ zyh$ pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.0.3

$ pip --version
pip 19.0.3 from /Users/zyh/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)

 
 

Installing PIP under mac

Project github address: bitcarmanlee easy-algorithm-interview-and practice
welcome to star, message, study and progress together
PIP is a common Python package management tool, similar to Java’s Maven. If you use Python, you can’t do without PIP.
when trying to install PIP using home-brew on the new MAC, there were some minor problems:

bogon:~ wanglei$ brew install pip
Error: No available formula with the name "pip"
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:

  https://pip.readthedocs.org/en/stable/installing/#install-pip

As you can see, PIP is installed with Python in home-BREW.
Another way:

bogon:~ wanglei$ sudo easy_install pip
Password:
Searching for pip
Reading https://pypi.python.org/simple/pip/
...

Just a moment, PIP is installed…

Error: could not install packages due to an environmenterror: [winerror 5] access denied.

Error installing PIP Install Pypiwin32.
ERROR: Could not install packages due to an EnvironmentError: [WinError 5]. Pyd ‘
Consider using the --user option or check the permissions.
will add –user after install Could not install packages due to an EnvironmentError: [WinError 5], can be solved in this way)

Error: option –single-version-externally-managed not recognized when python pip installs third-party libraries

Command: PIP install mysql-Connector-Python-RF ==2.1.3 Prompt error message when installing packages: Error :option — single-version — managednotrecognized
The reason may be that your installation package is a wheel-based installation package.
will report this error if you do not have wheels installed on your computer.
install wheel:
PIP install wheel
and then install with PIP I want package :
PIP install mysql-connector-python-rf==2.1.3

pygobject pip3 upgrade problem: ERROR: Failed building wheel for pycairo

The problem
This question is cut from a long paragraph and the full text is as follows, it is a problem encountered using pip3 or pip-review upgrade

pygobject==3.34.0 is available (you have 3.26.1)
Defaulting to user installation because normal site-packages is not writeable
Processing /home/thinszx/.cache/pip/wheels/78/4f/f8/35219d6282fc7d90d6713924a12fd05bb0f7eef0fa12bef507/distro_info-0.0.0-py3-none-any.whl
Collecting pygobject==3.34.0
  Using cached PyGObject-3.34.0.tar.gz (699 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /home/thinszx/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-pbwzvrms/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (50 lines):
  Collecting setuptools
    Using cached setuptools-45.2.0-py3-none-any.whl (584 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting pycairo
    Using cached pycairo-1.19.0.tar.gz (200 kB)
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (setup.py): started
    Building wheel for pycairo (setup.py): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-pgit5hrh
         cwd: /tmp/pip-install-sa57e6b8/pycairo/
    Complete output (12 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
    running build_ext
    'pkg-config' not found.
    Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
    Running setup.py clean for pycairo
  Failed to build pycairo
  Installing collected packages: setuptools, wheel, pycairo
      Running setup.py install for pycairo: started
      Running setup.py install for pycairo: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-y2i60oh4/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-pbwzvrms/overlay --compile --install-headers /tmp/pip-build-env-pbwzvrms/overlay/include/python3.6m/pycairo              cwd: /tmp/pip-install-sa57e6b8/pycairo/
      Complete output (12 lines):
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/cairo
      copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
      copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
      copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
      running build_ext
      'pkg-config' not found.
      Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-y2i60oh4/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-pbwzvrms/overlay --compile --install-headers /tmp/pip-build-env-pbwzvrms/overlay/include/python3.6m/pycairo Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/thinszx/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-pbwzvrms/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output. 

The solution
As for the package upgrade problem – V2EX, it is said that the PIP or pip3 upgrade will have problems, because the dependency of libgirepository1.0-dev is missing, install

sudo apt-get install libgirepository1.0-dev

And then one less than code>, cario less than /code>

sudo apt-get install python-cairo
sudo apt-get install libcairo2

Solution to the problem of installing lxml in Pip

1. The following error occurred while installing LXML using PIP:

& gt; > > pip install lxml

C:\Users\Chen>pip install lxml
Collecting lxml
  Using cached lxml-3.5.0.tar.gz
Installing collected packages: lxml
  Running setup.py install for lxml ... error
    Complete output from command "d:\program files\python\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\CHENJU~1\\AppData\\Local\\Temp\\pip-build-id5180h6\\lxml\\setup.py';
    Building lxml version 3.5.0.
    Building without Cython.
    ERROR: b"'xslt-config' \xb2\xbb\xca\xc7\xc4\xda\xb2\xbf\xbb\xf2\xcd\xe2\xb2\xbf\xc3\xfc\xc1\xee\xa3\xac\xd2\xb2\xb2\xbb\xca\xc7\xbf\xc9\xd4\xcb\xd0\xd0\xb5\xc4\xb3\xcc\xd0\xf2\r\n\xbb\xf2\xc
    ** make sure the development packages of libxml2 and libxslt are installed **

    Using build configuration of libxslt
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\lxml
    copying src\lxml\builder.py -> build\lib.win32-3.5\lxml
    copying src\lxml\cssselect.py -> build\lib.win32-3.5\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win32-3.5\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win32-3.5\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win32-3.5\lxml
    copying src\lxml\sax.py -> build\lib.win32-3.5\lxml
    copying src\lxml\usedoctest.py -> build\lib.win32-3.5\lxml
    copying src\lxml\_elementpath.py -> build\lib.win32-3.5\lxml
    copying src\lxml\__init__.py -> build\lib.win32-3.5\lxml
    creating build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win32-3.5\lxml\html
    creating build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\lxml.etree.h -> build\lib.win32-3.5\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.5\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\isoschematron\resources
    creating build\lib.win32-3.5\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-3.5\lxml\isoschematron\resources\rng
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    error: Unable to find vcvarsall.bat

    ----------------------------------------

2. Baidu to see how to solve the problem:

it turns out that this problem requires a separate operating system to handle. Nothing under window.

3. Linux system processing:

sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev

The or yum install…

and then proceed with PIP install LXML