I installed pyinstaller successfully by using pip3 install pyinstaller
Requirement already satisfied: pyinstaller in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (4.2)
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: altgraph in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (0.17)
Requirement already satisfied: macholib>=1.8; sys_platform == "darwin" in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (1.14)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyinstaller) (2020.11)
and btw, my echo $PATH returns:
/Users/apple/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
However, when I try to run this following code in my terminal in the same directory, it doesn't work:
apple#apples-MBP-2 app4.1_using_OOP % pyinstaller --onefile --windowed frontend.py
and it has the error:
zsh: command not found: pyinstaller
I tried many ways including:
Downgrading pip to 18.1 and run pip3 install pyinstaller again
Used apple#apples-MBP-2 app4.1_using_OOP % python -m PyInstaller frontend.py and it does run and has a disc folder where there is a file named frontend.app, but I can't open it.
Questions:
Why sometimes I can directly use the modules downloaded by pip3 but sometimes I can't?
If I want to add to my $PATH, do I add /Library/Frameworks?
I had the same issue. This command worked for me:
python3 -m PyInstaller your_script.py
Related
I search on google how to add OpenSSL in python. The command is easy to run.
pip install pyOpenSSL or pip3 install pyOpenSSL. I don't know if my OpenSSL is already installed. I have this response when I installed openssl.
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: pyopenssl in /usr/local/lib/python3.9/site-packages (20.0.1)
Requirement already satisfied: cryptography>=3.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (36.0.1)
Requirement already satisfied: six>=1.5.2 in /usr/local/lib/python3.9/site-packages (from pyopenssl) (1.16.0)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/site-packages (from cryptography>=3.2->pyopenssl) (1.15.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=3.2->pyopenssl) (2.21)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
this is my index.py code
import base64
import json
import requests
from OpenSSL import crypto
when I run this command python3 index.py. I always get this error
ModuleNotFoundError: No module named 'OpenSSL'
May i know what's the issue in my setup? Im new in python code. My python version is 3.10.0
It looks like you have pyopenssl installed for a Python 3.9 installation (look at the path: /usr/local/lib/python3.9), but you are trying to run with a Python 3.10 installation.
Use the pip from your Python 3.10 installation to install the required packages. python3 -m pip install pyOpenSSL should do that, regardless of what the standalone pip command resolves to.
I am trying to use PyCharm for my python 3 coding on my Linux, and it works great 90% of the time, but I notice that on occasion I cannot import certain packages. For example, when I click Settings->Project->Python Interpreter and try to install 'opencv-python', I get this error:
AttributeError: module 'setuptools.build_meta' has no attribute '__legacy__'
When I try to install opencv-python with pip I get this message:
$ pip install opencv-python
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: opencv-python in ./.local/lib/python3.6/site-packages (4.5.1.48)
Requirement already satisfied: numpy>=1.13.3 in ./.local/lib/python3.6/site-packages (from opencv-python) (1.19.2)
There seems to be some discrepency between the packages my computer has installed and the packages that PyCharm has installed. How can I solve this problem?
i installed django-ckeditor with pip but it goes to the "/home/def-dev/.local/lib/python3.8/site-packages" path when i'm trying to create venv manually.
but when i create project with pycharm it goes to the "./venv/lib/python3.8/site-packages" path
that this path belong's to internal project's venv .
and this make's unknown for pycharm .
what should i do to make pycharm find packages from "/home/def-dev/.local/lib/python3.8/site-packages" or when i'm creating venv manually pip save's packages into "./venv/lib/python3.8/site-packages" path.
when i create venv manually
$ pip3 install django-ckeditor
Requirement already satisfied: django-ckeditor in /home/def-dev/.local/lib/python3.8/site-
packages (5.9.0)
Requirement already satisfied: django-js-asset>=1.2.2 in /home/def-
dev/.local/lib/python3.8/site-packages (from django-ckeditor) (1.2.2)
when i create venv with pycharm
$ pip3 install django-ckeditor
Requirement already satisfied: django-ckeditor in ./venv/lib/python3.8/site-packages (5.9.0)
Requirement already satisfied: django-js-asset>=1.2.2 in ./venv/lib/python3.8/site-packages
(from django-ckeditor) (1.2.2)
When I run:
sudo -H pip install finsymbols
I get the below response:
Requirement already satisfied: finsymbols in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: beautifulsoup4>=4.2.1 in /usr/local/lib/python2.7/dist-packages (from finsymbols)
then when I run
$ python
>>> from finsymbols import symbols
I get
File "", line 1, in
ImportError: No module named finsymbols
My question is, why am I getting the error when the module is installed?
You may have multiple versions of Python.
Requirement already satisfied: finsymbols in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: beautifulsoup4>=4.2.1 in /usr/local/lib/python2.7/dist-packages (from finsymbols)
Pip has installed it in python2.7 path. Your default Python may be different.
So try using
$ python2.7
instead of
$ python
If you want to install a module that runs on Python 3.x, you need to use
pip3 install module_name
Or link the pip3 executable in /usr/bin to replace pip. In this way, you can use pip to install Python 3.x modules.
Here I strongly recommend to use virtualenv to manage your Python module environments. More details can be found here.
Thanks jonatan, that worked.
I ran
pip install finsymbols
not
sudo -H pip install finsymbols
and that fixed the issue
I was following the Flask tutorial and at some point installed an 'incomplete' version of the flaskr micro-blogging app. I would like to 'overwrite' this installation with one obtained from https://github.com/pallets/flask/tree/master/examples/flaskr.
However, in the directory ~/dev/scratch/flask/examples/flaskr, if I try to run
sudo pip install --editable .
I get the following:
The directory '/home/kurt/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kurt/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Obtaining file:///home/kurt/dev/scratch/flask/examples/flaskr
Requirement already satisfied: flask in /usr/local/lib/python2.7/dist-packages (from flaskr==0.0.0)
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: click>=2.0 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: Jinja2>=2.4 in /usr/lib/python2.7/dist-packages (from flask->flaskr==0.0.0)
Requirement already satisfied: MarkupSafe in /usr/lib/python2.7/dist-packages (from Jinja2>=2.4->flask->flaskr==0.0.0)
Installing collected packages: flaskr
Found existing installation: flaskr 0.0.0
Can't uninstall 'flaskr'. No files were found to uninstall.
Running setup.py develop for flaskr
Successfully installed flaskr
Apparently, pip found an 'existing installation' which it can't uninstall. I'd like to 'wipe out' this installation; however, if I try search for it using, in the directory /usr/local/lib,
find . -name '*flaskr*'
the only result I get is
./python2.7/dist-packages/flaskr.egg-link
If I rm this file, it seems to 'come back' automatically.
How can I re-install the 'flaskr' app cloned from its Github repository?
I solved the problem by going back to the directory I had installed the 'incomplete' version of flaskr from, and running the command
sudo python setup.py develop --uninstall
which produced the confirmation
running develop
Removing /usr/local/lib/python2.7/dist-packages/flaskr.egg-link (link to .)
Link points to ['/home/kurt/dev/scratch/flask/examples/flaskr', '.']: uninstall aborted
Then, going back to the directory with the 'complete' version (~/dev/scratch/flask/examples/flaskr), I ran sudo pip install --editable . followed by export FLASK_APP=flaskr. Then the command
flask initdb
prints the expected output
Initialized the database.